<template>
    <div id="shangpin">
        <div class="shangpin-wrap">
            <div class="shangpincontent">
                <ul class="shangpin-nav clearfix">
                    <li class="nav-content" v-for="(limit,kk) in dparr" :key="kk" @click="tiaodp(limit.spID)">
                        <img class="nav-tp" :src="'/img/'+imgwrap[kk][0]">
                        <div class="nav-yc">
                            <span class="nanjiren-s">{{limit.spname}}</span>
                            <span class="djjr">点击进入</span>
                        </div>
                    </li>
                    <li class="nav-content hyp" @click="hyh">
                        <img class="nav-tp2" src="../assets/img/ys/hyp.png">
                        <span>换一批</span>
                    </li>
                </ul>
            </div>
        </div>
        <div class="juhuasuan">
            <div class="juhuasuan-w">
                <div class="jihuasuan-img"><img src="../assets/img/ys/juhuasuan.jpg"></div>
            </div>
            <div class="mlrs-w clearfix">
                <div class="mlrs">
                    <span class="mlzw">美丽人生</span>
                    <span class="mlyw">FASHION & BEAUTY</span>
                </div>
                <div class="ml-nav">
                    <a>连衣裙</a>
                    <a>T恤男</a>
                    <a>美容护肤</a>
                    <a>休闲男鞋</a>
                    <a>黄金项链</a>
                    <a>单鞋</a>
                    <a>女包</a>
                    <a>文胸</a>
                    <a>大牌腕表</a>
                </div>
                <div class="rcsh-l">
                    <a>
                        <img class="mlrsimg" src="../assets/img/ys/mlrs.png">
                        <div class="rchd clearfix">
                            <div class="rchd-l"><span>日常活动</span></div>
                            <div class="rchd-r">
                                <div class="rr-info">
                                    <span>女神穿搭</span>
                                    <span>秋冬新品</span>
                                </div>
                            </div>
                        </div>
                        <div class="mlrsjt">
                            <img src="../assets/img/ys/mlrsjt.png">
                        </div>
                    </a>
                </div>
                <div class=" rcsh-r clearfix">
                    <div class="rr-infors" v-for="(limit,kkk) in ddd" :key="kkk" >
                        <div class="rinfor-top">
                            <img :src="'/img/'+imgsrc[kkk]">
                        </div>
                        <div class="rinfor-bottom">
                            <div class="rbottom" v-for="(a,k) in ms[kkk]" :key="k">{{a}}</div> 
                        </div> 
                        <div class="rjiage">￥<span v-for="(aa,k2) in jg[kkk]" :key="k2">{{aa}}</span></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    data(){
        return {
            ddd:null,
            dparr:null,
            unames:null,
            src:'',
            imgwrap:[],
            imgsrc:[],
            miaoshu:'',
            ms:[],
            jiage:'',
            jg:[],
            
        }
    },
    methods:{
        hyh(){
            axios.post("/api/zycdp").then((data)=>{
                if(data.data){
                        var _this=this
                        this.dparr=""
                        this.imgwrap=[]
                        this.dparr=data.data
                        for(var i=0;i<_this.dparr.length;i++){
                            _this.img=data.data[i].spimg.split(',')
                            _this.imgwrap.push(_this.img)
                            _this.img=""
                        }
                }else{
                    this.$toast({
                        message:"数据异常一秒后重新刷新页面，或者手动刷新",
                        duration:2000
                    })
                    window.location.href="/"
                }
            })
        },
        tiaodp(val){
            var _this=this
            if(this.unames){
                 this.$router.push({name:"shangpu",params:{id:val}})
            }else{
                this.$toast({
                    message:"用户未登录，请先登录",
                    duration:1000
                })
                 setTimeout(function(){
                     _this.$router.push("/login")
                 },1000)
            }
           
        }
    },
    created(){
        axios.get("/api/").then((data)=>{
            if(data.data){
               this.unames=data.data
            }else{
                this.unames=false
            }
        })
          axios.post('/api/tm').then((data)=>{
                if(data.data){
                  let _this=this  
                  this.ddd=data.data 
                for(var i=0;i<this.ddd.length;i++){
                    _this.img=data.data[i].img
                    _this.imgsrc.push(_this.img)
                    _this.img=""
                }
            }
            })
            
            axios.post('/api/miaoshu').then((data)=>{
                if(data.data){
                    let _this=this
                    for(var i=0;i<data.data.length;i++){
                        _this.miaoshu=data.data[i].miaoshutag.split(',')
                        _this.ms.push(_this.miaoshu)
                        console.log(_this.miaoshu)
                    }
                }
            })

             axios.post('/api/jiage').then((data)=>{
                if(data.data){
                    let _this=this
                    for(var i=0;i<data.data.length;i++){
                        _this.jiage=data.data[i].money.split(',')
                        _this.jg.push(_this.jiage)
                        console.log(_this.jiage)
                    }
                }
            })

        axios.post("/api/zycdp").then((data)=>{
            if(data.data){
                let _this=this
                this.dparr=data.data
                for(var i=0;i<_this.dparr.length;i++){
                    _this.img=data.data[i].spimg.split(',')
                    _this.imgwrap.push(_this.img)
                    _this.img=""
                }
            }else{
                this.$toast({
                    message:"数据异常一秒后重新刷新页面，或者手动刷新",
                    duration:2000
                })
                window.location.href="/"
            }
        })

    }
}
</script>

<style>
/* /------------------juhuasuan-------------------------------/  */
img{
    vertical-align: -webkit-baseline-middle;
}
.rjiage{
    width: 234px;
    height: 18px;    
    font-size: 18px;
    color: #FF0036;
    line-height: 18px;
    margin: 10px auto 23px;
}
.rr-infors:hover{
    border: #FF0036 1px solid;
    box-sizing: border-box;
}
.rr-infors:hover .rinfor-top{
    opacity: .7;
}
.rjiage>span{
    margin-right: 7px;
}
.rbottom{
    color: #333333;
    width: 135px;
    height: 40px;
    font-size: 14px;
    overflow: hidden;
    margin: 10px auto;
}
.rcsh-r{
    float: left;
    width:995px;
}
.rinfor-top{
    margin: 15px auto 10px;
    width: 185px;
    height: 185px;
}
.rinfor-top>img{
    width: 100%;
    height: 100%;
}
.rr-infors{
    border: none;
    transition: .2s linear;
    cursor: pointer;
    text-align: center;
    float: left;
    margin:0 0 13px 8px;
    float: left;
    background: #fff;
    width: 236px;
    border: 1px solid transparent;
}

/* /-----------------------------------------/  */

.mlrsjt{
    width: 235px;
    height: 60px;
    position: absolute;
    bottom: 0;
}
.mlrsjt>img{
    right: 20px;
    position: absolute;
    display: block;
    width: 32px;
    height: 32px;
}
.rchd-l>span{
    width: 36px;
    height: 48px;
    display:inline-block;
}
.rr-info>span{
    width: 114px;
    line-height: 24px;
    display: inline-block;
}
.rr-info{
    text-align: center;
    width: 114px;
    height: 48px;
    margin: 8px 14px 0 0;
}
.rchd-r{
    float: left;
    font-size: 18px;
    float: left;
    color:#fff; 
    width: 128px;
    height: 64px;
    background: rgba(0,0,0,.6)
}
.rcsh-l:hover .mlrsimg{
    opacity: .7;
}
.rchd-l{
    float: left;
    position: relative;
    padding: 7px;
    text-align: center;
    font-size: 18px;
    width: 70px;
    height: 64px;
    background: rgba(0,0,0,.9);
    color:#fff;
}
.rchd{
    left:-1px;
    bottom: 20%;
    width: 218px;
    height: 64px;
    position: absolute;
}
.rcsh-l{
    float: left;
    cursor: pointer;
    position: relative;
    width:235px;
    height: 618px;
    overflow: hidden;
}
.rcsh-l>a>img{
    transition:all .2s linear;
    width: 100%;
    height: 100%;
}
.mlrs-w{
    margin: 20px auto;
    width: 1230px;
}
.ml-nav{
    text-align: right;
    margin-bottom: 8px;
    font-size: 14px;
    width: 800px;
    height: 30px;
    float: right;
    line-height: 30px;
}
.ml-nav>a{
    margin-left: 20px;
    cursor: pointer;
    color: #000;
}
.ml-nav>a:last-child{
    margin-right: 20px;
}
.ml-nav>a:hover{
    text-decoration:underline;
}
.mlrs{
    margin-bottom: 10px;
    float: left;
    border-left: 5px solid #333333;
    width: 220px;
    height: 27px;
    text-align: right;
    line-height: 30px;
}
.mlyw{
    font-size: 12px;
}
.juhuasuan{
    padding-top:10px;
    width: 100%;
    background: #F5F5F5;
}
.juhuasuan-w{
    width: 1230px;
    background: #fff;
    margin: 0 auto;
}
.jihuasuan-img{
    overflow: hidden;
}
.jihuasuan-img img{
    margin-left: -180px;
}
/* ----------------------------------------------//  */
.nav-tp2{
    transition: .5s;
}
.hyp{
    cursor: pointer;
}
.hyp:hover .nav-tp2{
    transform: rotate(360deg)
}
.nav-tp{
    width: 100px;
    height: 50px;
}
.nav-content:hover .nav-yc{
    display: block;
}
.nav-content{
    position: relative;
}
.djjr{
    background:#FF0036;
    display: block;
    border-radius: 10px;
    color: #fff;
    height: 18px;
    width: 63px;
    top:70px;
    left:30px;
    position: absolute;
}
.nanjiren-s{
    position: absolute;
    top:30px;
    left: 25px;
    color: #fff;
    font-size: 14px;
    max-width: 70px;

}
.nav-yc{
    display: none;
    cursor: pointer;
    line-height:14px!important;
    text-align: center;
    top: 0;
    left: 0;
    width:122px;
    height: 108px;
    background: rgba(0,0,0,.8);
    position: absolute;
}
.shangpin-wrap{
    background: #F5F5F5;
    width: 100%;
    /* height:327px; */
    padding: 10px 0px;
}
.shangpincontent{
    width: 1230px;
    height: 327px;
    margin: 0 auto;
    background: #fff;
}
.shangpin-nav{
    width: 100%;
    height: 100%;
}                
.nav-content{
    float: left;
    border-bottom:1px solid #eee;
    border-right:1px solid #eee;
    background: #fff;
    text-align: center;
    width: 122px;
    height: 108px;
    line-height: 108px;
}
.nav-content:nth-child(10n){
    border-right:none;
}
/* -------------------------------------------------- */
*{
	box-sizing: border-box;
}
body,ul,li,p,h1,h2,h3,em{
	margin: 0;
	padding: 0;
}
li{
	list-style: none;
	font-family: "微软雅黑";
	font-size: 12px;
	color: #666;
}
.w1230{
	width: 1230px;
}
h1,h2,h3{
	font-weight: normal;
}
.clearfix::before{
    clear: both;
    content: '';
    display: block;
}
/* //---------------------------------------------------  */
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
</style>